package m.fun.model;

import m.base.model.UserInfo;
import m.common.model.*;
import m.common.model.type.FieldType;
import m.common.model.util.ModelQueryList;
import m.common.model.util.QueryCondition;
import m.store.model.GuestInfo;
import m.store.model.SaleInfo;
import manage.model.StatusModel;

import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

@TableMeta(name = "tf_ask_info", description = "询价信息")
public class AskInfo extends StatusModel implements MigrationModel {
    @Override
    public List<String> migrationOidList(String storeOid) throws Exception {
        return ModelQueryList.getModelList(this.getClass(),new String[]{"oid"},null,
                        QueryCondition.eq("user.store.oid",storeOid))
                .stream().map(Model::getOid).collect(Collectors.toList());
    }
    @LinkTableMeta(name="user_oid",table= UserInfo.class,description="所属用户")
    private UserInfo user;
    @LinkTableMeta(name="guest_oid",table= GuestInfo.class,description="客户")
    private GuestInfo guest;
    @FieldMeta(name="type",type= FieldType.STRING,description="类型",dictOption = "A:公司,B:个人")
    private String type;
    @FieldMeta(name="name",type= FieldType.STRING,length=50,description="公司名称")
    private String name;
    @FieldMeta(name="duty_user",type= FieldType.STRING,length=20,description="负责人")
    private String dutyUser;
    @FieldMeta(name="tel",type= FieldType.STRING,length=20,description="联系电话")
    private String tel;
    @FieldMeta(name="address",type= FieldType.STRING,length=300,description="收货地址")
    private String address;
    @FieldMeta(name = "description",type = FieldType.STRING,length = 1000,description = "需求备注")
    private String description;

    @FieldMeta(name="submit_date",type= FieldType.DATE,description="提交时间")
    private Date submitDate;
    @LinkTableMeta(name="sale_oid",table= SaleInfo.class,description="出库信息")
    private SaleInfo sale;
    @FieldMeta(name="build_status",type= FieldType.STRING,defaultValue = "N",description="生成状态",dictOption = "N:未生成,Y:已生成")
    private String buildStatus;
    public final static String Build_No="N";
    public final static String Build_Done="Y";

    public GuestInfo getGuest() {
        return guest;
    }

    public void setGuest(GuestInfo guest) {
        this.guest = guest;
    }

    public Date getSubmitDate() {
        return submitDate;
    }

    public void setSubmitDate(Date submitDate) {
        this.submitDate = submitDate;
    }

    public SaleInfo getSale() {
        return sale;
    }

    public void setSale(SaleInfo sale) {
        this.sale = sale;
    }

    public String getBuildStatus() {
        return buildStatus;
    }

    public void setBuildStatus(String buildStatus) {
        this.buildStatus = buildStatus;
    }

    public UserInfo getUser() {
        return user;
    }

    public void setUser(UserInfo user) {
        this.user = user;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDutyUser() {
        return dutyUser;
    }

    public void setDutyUser(String dutyUser) {
        this.dutyUser = dutyUser;
    }

    public String getTel() {
        return tel;
    }

    public void setTel(String tel) {
        this.tel = tel;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }
}
